var myGrid;
var dataurl = "datalist!datalist";
$(function(){
	myGrid = $("#list").jqGrid({
			url : dataurl,
			datatype : "json",
			mtype : 'GET',
			colNames : [
			     "标题",
			     "路径",
			     "管理"
			],
			colModel : [
			            {
			            	name:"name",
			            	index:"name",
			            	width:200
			            },
			            {
			                name:"relativePath",
			                index:"relativePath",
			                width:100
			            },
			            {
			            	name:"sid",
			            	index:"sid",
			            	formatter:deleteFormatter
			            }
			],
			pager : '#pager',
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			sortname : 'updateDate',
			sortorder : 'desc',
			viewrecords : true,
			caption : "规章制度列表",
			width : '750',
			height : '300',
			jsonReader : {
				repeatitems : false,
				id : "0"
			}
		});	
	
	
	myGrid.jqGrid("navGrid", "#pager", {
		edit : false,
		add : false,
		del : false,
		search : false
	});
	myGrid.jqGrid("navButtonAdd", "#pager", {
		onClickButton : function() {
			doGet(navObj.rules.core+navObj.core.start);
		},
		buttonicon : "ui-icon-newwin",
		caption : "添加",
		id : "newGroup"
	});
	
	myGrid.jqGrid("navButtonAdd", "#pager", {
		onClickButton : function() {
			reIndexAll();
		},
		caption : "重建索引",
		id : "newGroupIndex"
	});
});

function reIndexAll() {
	
}

function deleteFormatter(v,opt,row){
	/*var a = $("<a><img style='border:none' src='"+sbase+"images/removeme.gif'/></a>");
	a.attr("href":"javascript:removeRule('"+v+"');");
	return $("<p></p>").append(a).html();*/
}
function removeRule(id){
	var url = navObj.rules.core+navObj.core.remove+"?bean.sid"+id;
	duSubmit(url,{},function(){
		
		myGrid.trigger("reloadGrid");
	});
	
	
}